package object;

import java.util.Scanner;

public class Test_3 {
    public static void login() throws UserNameExpection,UserMiExpection {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入用户名：");
        String s1 = scanner.next();
        System.out.println("请输入密码：");
        String s2 = scanner.next();
        if(!s1.equals("admin")){
            throw new UserNameExpection("输入错误");
        }
        if(!s2.equals("123456")){
            throw new UserMiExpection("输入错误");
        }
        System.out.println("输入正确");
    }

    public static void main(String[] args) throws UserMiExpection, UserNameExpection {
        login();
    }
}

class UserNameExpection extends Exception{
    public UserNameExpection(String s) {
        super(s);
    }
}
class UserMiExpection extends Throwable {
    public UserMiExpection(String s) {
        super(s);
    }
}




